<template>
  <view class="flex-warp" @click="handleToDetail">
    <view class="left">
      <view class="-title">{{ item?.title }}</view>
      <view class="-desc">{{ item?.dept }}</view>
    </view>
    <view v-if="item?.amount && item?.amount >= 1" class="right">
      <text class="-num">{{ item?.amount }}万</text>
      <text class="-unit">元</text>
    </view>
    <view v-else class="right">查看详情</view>
  </view>
</template>

<script lang="ts" setup>
  import { ReportItem } from '@/api/membership/types';
  import { navigateTo } from '@/router';
  import { PropType } from 'vue';

  const props = defineProps({
    item: Object as PropType<ReportItem>,
  });

  function handleToDetail() {
    navigateTo({ name: 'policyDetail', options: { id: props.item?.id } });
  }
</script>

<style lang="scss" scoped>
  .flex-warp {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    padding: 30rpx;
    padding-top: 20rpx;
    width: 692rpx;
    margin: 0 auto;
    margin-top: 30rpx;
    box-sizing: border-box;
    border-radius: 20rpx;
    .left {
      text-align: left;
      max-width: 500rpx;
      .-title {
        font-size: 31rpx;
        color: #333333;
      }
      .-desc {
        font-size: 23rpx;
        color: #808080;
        margin-top: 15rpx;
      }
    }
    .right {
      color: #b47026;
      flex-shrink: 0;
      .-num {
        font-size: 40rpx;
      }
      .-unit {
        font-size: 23rpx;
      }
    }
  }
</style>
